package Grafica;
import javax . swing .*;
import java . awt .*;
class FereastraPrincipala extends JFrame {

    public FereastraPrincipala ( String titlu ) {
      super ( titlu ) ;


      setSize (300 , 200) ;
      setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE ) ;

      
      // fin=fereastra   1 = numarul ferestrei
      // avem 3 ferestre interne: fin1,fin2,fin3

      FereastraInterna fin1 = new FereastraInterna () ;
      fin1 . setVisible ( true ) ;
      FereastraInterna fin2 = new FereastraInterna () ;
      fin2 . setVisible ( true ) ;
      FereastraInterna fin3 = new FereastraInterna () ;
      fin3 . setVisible (true ) ;

// afisarea in Container (JdesktopPane)  se face cu , comanda: desktop . add ...... ca in aplicatia de jos.

      JDesktopPane desktop = new JDesktopPane () ;
      desktop . add ( fin1 ) ;
      desktop . add ( fin2 ) ;
      desktop . add ( fin3 ) ;

  // asezarea ferestrelor .... fin2 . moveToFront () : ...

      setContentPane ( desktop ) ;
      fin2 . moveToFront () ;
      fin3 . moveToFront () ;
  }
}


class FereastraInterna extends JInternalFrame {
  static int n = 0; // nr . de ferestre interne
  static final int x = 30 , y = 30;


  public FereastraInterna () {
    super ( " NewFolder # " + (++ n ) ,

                   true , // resizable
          true , // closable
          true , // maximizable
          true ) ; // iconifiable
    setLocation ( x *n , y * n ) ;
    setSize ( new Dimension (200 , 100) ) ;
  }
}



  public class TestInternalFrame {
  public static void main ( String args []) {
  new FereastraPrincipala( " Test ferestre interne " ).show() ;
  }
}
